<template>
  <el-form
    :model="momentForm"
    style="width: 600px; margin: 50px auto"
    label-width="80px"
  >
    <el-form-item label="活动照片">
      <el-upload
        class="avatar-uploader"
        style="
          border: 1px dashed #d9d9d9;
          border-radius: 6px;
          cursor: pointer;
          position: relative;
          overflow: hidden;
          display: flex;
          justify-content: center;
        "
        action=""
        :show-file-list="true"
        :on-success="handleAvatarSuccess"
        :before-upload="beforeAvatarUpload"
      >
        <img v-if="imageUrl" :src="imageUrl" class="avatar" />
        <i v-else class="el-icon-plus avatar-uploader-icon" />
      </el-upload>
    </el-form-item>
    <el-form-item label="活动标题">
      <el-input v-model="momentForm.title" />
    </el-form-item>
    <el-form-item label="活动内容">
      <el-input
        v-model="momentForm.content"
        type="textarea"
        :autosize="{ minRows: 5, maxRows: 8 }"
      />
    </el-form-item>
    <el-button
      type="primary"
      style="width: calc(100% - 80px); float: right"
      @click="update"
      >确 定</el-button
    >
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      momentForm: {
        cover: "",
        title: "",
        content: "",
      },
    };
  },
  methods: {
    update() {},
  },
};
</script>

<style lang="scss" scoped>
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
